package src.com.doit.Demo06;
//匿名内部类
public class Test {
    public static void main(String[] args) {

        YanZi yz = new YanZi();
        yz.open();
        yz.fly();
        yz.close();

        Fly fy = new Fly() {//匿名内部类 多态写法
            @Override
            public void open() {
                System.out.println("喷气打开");
            }

            @Override
            public void fly() {
                System.out.println("喷气式起飞");
            }

            @Override
            public void close() {
                System.out.println("喷气式降落");
            }
        };
        fy.fly();
        new Fly() {//匿名内部类 直接调用
            @Override
            public void open() {
                System.out.println("喷气打开");
            }

            @Override
            public void fly() {
                System.out.println("喷气式起飞");
            }

            @Override
            public void close() {
                System.out.println("喷气式降落");
            }
        }.fly();
        YanZi g = new YanZi(){
          public void open()
          {
              System.out.println("我不起飞");
          }
        };
        g.open();
    }
}
